#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <unistd.h>

#include "debug.h"
#include "sm2_test.h"
#include "sm3_test.h"
#include "sm4_test.h"
#include "vli_test.h"

void pinfo()
{
    printf("------- info start ------\n");
    printf("\ninput number to run test:\n\n");
    printf("\t q - exit test\n");
    printf("\t 1 - run sm2 make key test.\n");
    printf("\t 2 - run sm2 public key test,\n");
    printf("\t 3 - run sm2 sign test,\n");
    printf("\t 4 - run sm2 sign test ex,\n");
    printf("\t 5 - run sm2 key ex test,\n");
    printf("\t 6 - run sm2 enc/dec test,\n");
    printf("\t 7 - run sm3 test.\n");
    printf("\t 8 - run sm4 ecb test.\n");
    printf("\t 9 - run sm4 cbc test.\n");
    printf("\t 10 - run sm3 std test 1.\n");
    printf("\t 11 - run sm3 std test 2.\n");
    printf("\t 12 - run vli test.\n");
    printf("\n------ info end ------\n\n");
}

typedef void (*func_t)();

func_t func_table[] = {
    test_sm2_make_key, test_sm2_public_key, test_sm2_sign, test_sm2_sign_ex,
    test_sm2_dh,       test_sm2_encrypt,    test_sm3,      test_sm4,
    test_sm4_cbc,      test_sm3_std1,       test_sm3_std2,
    vli_test};

int main(int argc, char** argv)
{
    // while (1) {
        // int a = 0;
        // pinfo();
        // fscanf(stdin, "%d", &a);
        // if (a == 0 || a == 'q') {
        //     break;
        // }
        // if (a > sizeof(func_table) / 8) continue;

        func_table[11]();
    // }
}
